<?

class FriendRenderer extends TRepeaterItemRenderer
{
	// This method returns the userRecord object
	// use record in Friend ..compare with owner obj.
	//  always user the id that doesnt the owner id
	public function getFriend()
	{		
		
		$owner = $this->getPage()->getCurrentRecord();
		
		if($owner->user_id == $this->Data->user_id) // use friend_id		
			$friend = UserRecord::finder()->findByPk($this->Data->friend_id);	
		else // use user_id		
			$friend = UserRecord::finder()->findByPk($this->Data->user_id);			
		
		return $friend;			
	}
	
	public function getLink()
	{
		$owner = $this->getPage()->getCurrentRecord();
		if($owner->user_id == $this->Data->user_id) // use friend_id
			return $this->Data->friend_id;
		else // use user_id
			return $this->Data->user_id;
	}
	

	
}

?>